#ifndef CLIENTHANDLER_H
#define CLIENTHANDLER_H

#include "../common/handler.h"

//静态策略函数:打包信息,发送到服务端
//handle函数处理接收到信息后的操作


class Client;

//客户端管理方法
class ClientHandler : public Handler
{
public:
    ClientHandler(Client* client);
};

//客户端管理方法接口
class ClientIHandler : public IHandler
{
public:
    ClientIHandler(Client* client) : client(client) {}

protected:
    Client* client; // 依赖Client，用于发送数据
};

// 注册策略
class ClientHandlerRegister : public ClientIHandler
{
public:
    ClientHandlerRegister(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer(const QString& username, const QString& password);
};

// 登录策略
class ClientHandlerLogin : public ClientIHandler
{
public:
    ClientHandlerLogin(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer(const QString& username, const QString& password);
};

//获取房间策略
class ClientHandlerGetRoom : public ClientIHandler
{
public:
    ClientHandlerGetRoom(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer();
};

// 聊天策略
class ClientHandlerChat : public ClientIHandler
{
public:
    ClientHandlerChat(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer(const QString& message);
};

//创建房间策略
class ClientHandlerCreateRoom : public ClientIHandler
{
    public:
    ClientHandlerCreateRoom(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer(const QString& roomid);
};

//加入房间策略
class ClientHandlerJoinRoom : public ClientIHandler
{
    public:
    ClientHandlerJoinRoom(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer(const QString& roomid);
};

//退出房间策略
class ClientHandlerCloseRoom : public ClientIHandler
{
    public:
    ClientHandlerCloseRoom(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer();
};

//添加观众策略
class ClientHandlerAddAudi : public ClientIHandler
{
    public:
    ClientHandlerAddAudi(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer();
};

//删去观众策略
class ClientHandlerDeleAudi : public ClientIHandler
{
    public:
    ClientHandlerDeleAudi(Client* client) : ClientIHandler(client) {}

    virtual void handle(const QByteArray& data) override;
    static void transfer();
};

//接收音频策略
class ClientHandlerAudioTrans : public ClientIHandler
{
    public:
    ClientHandlerAudioTrans(Client* client) : ClientIHandler(client) {}
    virtual void handle(const QByteArray& data) override;
    static void transfer(QByteArray& data);

};

//视频策略
class ClientHandlerVideoTrans : public ClientIHandler
{
    public:
    ClientHandlerVideoTrans(Client* client) : ClientIHandler(client) {}
    virtual void handle(const QByteArray& data) override;
    static void transfer(const QByteArray& data);

};

//视频策略
class ClientHandlerHeartCheck : public ClientIHandler
{
    public:
    ClientHandlerHeartCheck(Client* client) : ClientIHandler(client) {}
    virtual void handle(const QByteArray& data) override;
    //static void transfer(const QByteArray& data);

};

#endif // CLIENTHANDLER_H
